import request from "@/request";
import { AxiosResponse } from "axios";
import ResultEnum from "@/config/ResultEnum";
import { message } from "ant-design-vue";

//表格列
export const tableCols = [
  {
    title: "#",
    dataIndex: "idx",
    key: "idx",
    width: 50,
  },
  {
    title: "标题",
    dataIndex: "subject",
    key: "subject",
  },
  {
    title: "发送人",
    dataIndex: "from",
    key: "from",
  },
  {
    title: "接收人",
    dataIndex: "to",
    key: "to",
  },
  {
    title: "抄送人",
    key: "cc",
    dataIndex: "cc",
  },
  {
    title: "创建时间",
    key: "createdTime",
    dataIndex: "createdTime",
  },
  {
    title: "操作",
    width: "100px",
    key: "actions",
  },
];

//获取数据
export const loadTable = (params: any) => {
  return new Promise((resolve: any, reject: any) => {
    request({
      url: "/emailSendLog/list",
      method: "get",
      params,
    }).then((res: any) => {
      if (res.code == ResultEnum.SUCCESS_CODE) {
        resolve(res.result);
      } else {
        message.error(res.message);
      }
    });
  });
};
